package com.netty.zhanglong.protobuf.example;

import com.google.protobuf.InvalidProtocolBufferException;

/**
 * Description:
 *
 * @author: StriverFeng
 * @date: 2018-9-30
 * Details:
 */
public class ProtoBufTest {
    public static void main(String[] args) throws InvalidProtocolBufferException {
        DataInfo.Student student=DataInfo.Student.newBuilder().setName("张三").setAddress("北京 ").setAge(20).build();
        byte[] bytes = student.toByteArray();
        DataInfo.Student student1 = DataInfo.Student.parseFrom(bytes);
        System.out.println(student1.getAge());
        System.out.println(student1.getAddress());
        System.out.println(student1.getName());
    }
}
